

namespace Stee.CAP8.MessageBus.Interface.Delegates
{
    using System.Collections.Generic;
    using Stee.CAP8.MessageBus.Interface.Models;


    #region Publish

    /// <summary>
    /// Handler for outgoing message publish outcome
    /// </summary>
    /// <param name="publishOutcome">Published outcome</param>
    /// <returns>Return TRUE if published outcome is handled successfully else FALSE</returns>
    public delegate bool HandlePublishResponse(PublishOutcome publishOutcome);

    #endregion Publish


    #region Subscribe

    /// <summary>
    /// Handler for incoming message from subscribed topic
    /// </summary>
    /// <param name="topic">Message topic</param>
    /// <param name="messageType">Message type</param>
    /// <param name="message">Consumed topic message</param>
    /// <param name="properties">Consumed topic message headers/properties</param>
    /// <returns>Return TRUE if the incoming message was consumed successfully else FALSE</returns>
    public delegate bool HandleSubscribeMessage(TopicName topic, string messageType, byte[] message, Dictionary<string, byte[]> properties);

    /// <summary>
    /// Handler for incoming command message from subscribed topic
    /// </summary>
    /// <param name="topic">Message topic</param>
    /// <param name="commandMessage">Command message</param>
    /// <returns>Return TRUE if the incoming message was consumed successfully else FALSE</returns>
    public delegate bool HandleSubscribeCommand(TopicName topic, CommandMessage commandMessage);

    /// <summary>
    /// Handler for incoming event message from subscribed topic
    /// </summary>
    /// <param name="topic">Message topic</param>
    /// <param name="eventMessage">Event message</param>
    /// <returns>Return TRUE if the incoming message was consumed successfully else FALSE</returns>
    public delegate bool HandleSubscribeEvent(TopicName topic, EventMessage eventMessage);

    #endregion Subscribe
}
